<template>
  <div id="app">
    <div class="countdown-mask"></div>
    <div class="countdown-container">
      <div class="countdown-box">
        <div class="countdown-text"></div>
      </div>
    </div>
    <!-- 路由占位符 -->
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'app',
  provide() {
    return {
      countDown: this.countDown
    }
  },
  data() {
    return {
      timer: null
    }
  },
  methods: {
    countDown() {
      // 倒计时
      clearInterval(this.timer)
      let time = 3
      var countDownMask = document.querySelector('.countdown-mask')
      var countDownContainer = document.querySelector('.countdown-container')
      this.timer = setInterval(function() {
        if (time <= 0) {
          // 模态框关闭
          clearInterval(this.timer)
          countDownMask.style.display = 'none'
          countDownContainer.style.display = 'none'
          // window.location.reload()//页面重新加载
        } else {
          countDownMask.style.display = 'block'
          countDownContainer.style.display = 'block'
          var countdownText = document.querySelector('.countdown-text')
          countdownText.innerHTML = time
          time--
        }
      }, 1000)
    }
  }
}
</script>
<style scoped>
.countdown-mask {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
}
.countdown-container {
  width: 380px;
  height: 380px;
  margin: 0 auto;
  position: relative;
  top: 50%;
  margin-top: -190px;
  z-index: 2000;
  display: none;
}
.countdown-box {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.38);
  text-align: center;
}
.countdown-text {
  width: 100%;
  font-size: 160px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.6);
  position: relative;
  top: 25%;
  height: 100px;
}
.el-radio-group /deep/ .el-radio__inner::after {
  width: 0;
}
.el-radio-group /deep/ .el-radio__input.is-checked + .el-radio__label {
  color: #333;
}
.el-radio-group /deep/ .el-radio {
  color: #333;
}
</style>
